<%inherit file="base.html"/>

<%def name="head()">
<script>
    function deleteBas(bas_id)
    {
        if(confirm("确认删除吗？"))
        {
            window.location.href = "/bas/delete?bas_id="+bas_id;
        }
    }
</script>
</%def>

<%def name="body()">
<section class="content">
<div class="box">
    <div class="panel-heading"><i class="fa fa-sitemap"></i> BAS列表</div>
        <div class="panel-body">
            <div class="container">
                <div class="pull-right bottom10">
                    % if permit.match('/bas/add'):
                     <a href="/bas/add" class="btn btn-sm btn-default">增加BAS</a>
                    % endif
                </div>

                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>BAS名称</th>
                            <th>BAS地址</th>
                            <th>BAS类型</th>
                            <th>共享密钥</th>
                            <th>CoA端口</th>
                            <th>时区</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        % for bas in bas_list:
                            <tr>
                                <td>${bas.bas_name}</td>
                                <td>${bas.ip_addr}</td>
                                <td>${bastype[str(bas.vendor_id)]}</td>
                                <td>${bas.bas_secret}</td>
                                <td>${bas.coa_port}</td>
                                <td>${{0:u"标准时区，北京时间",1:u"时间与时区相同"}[bas.time_type]}
                                </td>
                                <td>
                                    % if permit.match('/bas/update'):
                                    <a class="opt-btn btn-default" href="/bas/update?bas_id=${bas.id}">修改</a>
                                    % endif
                                    % if permit.match('/bas/delete'):
                                    <a class="opt-btn btn-default" href="javascript:deleteBas('${bas.id}')">删除</a>
                                    % endif
                                </td>
                            </tr>
                        % endfor
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>
</%def>